package com.ruoyi.labdata.service.impl;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.labdata.mapper.LabEmployeeRoleMapper;
import com.ruoyi.labdata.domain.LabEmployeeRole;
import com.ruoyi.labdata.service.ILabEmployeeRoleService;
import com.ruoyi.system.domain.SysUserRole;

/**
 * 用户和角色关联Service业务层处理
 * 
 * @author winner pan
 * @date 2022-05-03
 */
@Service
public class LabEmployeeRoleServiceImpl implements ILabEmployeeRoleService {
	@Autowired
	private LabEmployeeRoleMapper labEmployeeRoleMapper;

	/**
	 * 查询用户和角色关联
	 * 
	 * @param employeeId
	 *            用户和角色关联ID
	 * @return 用户和角色关联
	 */
	@Override
	public LabEmployeeRole selectLabEmployeeRoleById(Long employeeId) {
		return labEmployeeRoleMapper.selectLabEmployeeRoleById(employeeId);
	}

	/**
	 * 查询用户和角色关联列表
	 * 
	 * @param labEmployeeRole
	 *            用户和角色关联
	 * @return 用户和角色关联
	 */
	@Override
	public List<Long> selectRolesByEmployeeId(Long employeeId) {
		return labEmployeeRoleMapper.selectRolesByEmployeeId(employeeId);
	}

	/**
	 * 新增用户和角色关联
	 * 
	 * @param labEmployeeRole
	 *            用户和角色关联
	 * @return 结果
	 */
	@Override
	public int insertLabEmployeeRole(LabEmployeeRole labEmployeeRole) {
		return labEmployeeRoleMapper.insertLabEmployeeRole(labEmployeeRole);
	}

	/**
	 * 修改用户和角色关联
	 * 
	 * @param labEmployeeRole
	 *            用户和角色关联
	 * @return 结果
	 */
	@Override
	public int updateLabEmployeeRole(LabEmployeeRole labEmployeeRole) {
		return labEmployeeRoleMapper.updateLabEmployeeRole(labEmployeeRole);
	}

	/**
	 * 批量删除用户和角色关联
	 * 
	 * @param employeeIds
	 *            需要删除的用户和角色关联ID
	 * @return 结果
	 */
	@Override
	public int deleteLabEmployeeRoleByIds(Long[] employeeIds) {
		return labEmployeeRoleMapper.deleteLabEmployeeRoleByIds(employeeIds);
	}

	/**
	 * 删除用户和角色关联信息
	 * 
	 * @param employeeId
	 *            用户和角色关联ID
	 * @return 结果
	 */
	@Override
	public int deleteLabEmployeeRoleById(Long employeeId) {
		return labEmployeeRoleMapper.deleteLabEmployeeRoleById(employeeId);
	}

	/**
	 * 批量新增用户角色信息
	 * 
	 * @param userRoleList
	 *            用户角色列表
	 * @return 结果
	 */
	public int batchLabEmployeeRole(List<LabEmployeeRole> labEmployeeRoleList) {
		return this.labEmployeeRoleMapper.batchLabEmployeeRole(labEmployeeRoleList);
	}

	/**
	 * 删除用户和角色关联信息
	 * 
	 * @param userRole
	 *            用户和角色关联信息
	 * @return 结果
	 */
	public int deleteLabEmployeeRoleInfo(LabEmployeeRole labEmployeeRole) {
		return this.labEmployeeRoleMapper.deleteLabEmployeeRoleInfo(labEmployeeRole);
	}

	/**
	 * 批量取消授权用户角色
	 * 
	 * @param roleId
	 *            角色ID
	 * @param userIds
	 *            需要删除的用户数据ID
	 * @return 结果
	 */
	public int deleteLabEmployeeRoleInfos(@Param("roleId") Long roleId, @Param("employeeIds") Long[] employeeIds) {
		return this.labEmployeeRoleMapper.deleteLabEmployeeRoleInfos(roleId, employeeIds);
	}
}
